package com.zhouyu.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @ClassName:InitialBeanPostProcessor
 * @Auther: xierongchang
 * @Description:
 * @Date: 2024/6/20 16:32
 * @Version: v1.0.0
 */
@Component

public class InitialBeanPostProcessor implements BeanPostProcessor {

	public InitialBeanPostProcessor() {
		System.out.println("第4步：这是BeanPostProcessor实现类(InitialBeanPostProcessor)的构造器！！");
	}

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		System.out.println("第14步：postProcessBeforeInitialization(BeanPostProcessor接口实现类InitialBeanPostProcessor的方法)对属性进行更改, bean = " + bean.getClass());
		return bean;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		System.out.println("第18步：postProcessAfterInitialization(BeanPostProcessor接口的方法)对属性进行更改, bean = " + bean.getClass());
		return bean;
	}
}
